-module(test_client).
-export([echo/1]).

echo(Data) ->
    {ok, Socket} = gen_tcp:connect("localhost", 4567, [binary, {packet, 4},
						       {reuseaddr, true},
						       {active, false}]),
    ok = gen_tcp:send(Socket, Data),
    case gen_tcp:recv(Socket, 0) of
	{ok, Res} ->
	    io:format("(~p)received: ~p~n", [Socket, Res]);
	{error, closed} ->
	    io:format("(~p)tcp_closed~n", [Socket])
    end.
